{include file="public/header" /}

<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-col-md12">
        <div class="layui-card">
          <div class="layui-card-body">
            <fieldset id="searchFieldset_currentTableRenderId" class="table-search-fieldset">
              <legend>条件搜索</legend>
              <form class="layui-form layui-form-pane form-search">
                <div class="layui-form-item layui-inline">
                  <label class="layui-form-label">类型</label>
                  <div class="layui-input-inline">
                    <select name="type">
                      <option value="">选择类型</option>
                      {foreach $typepeople as $k => $v}
                      <option value="{$k}" {if !empty(input('get.type')) && input('get.type')==$k}selected{/if}>
                        {$v|default=''}</option>
                      {/foreach}
                    </select>
                  </div>
                </div>
                <div class="layui-form-item layui-inline">
                  <label class="layui-form-label">放假状态</label>
                  <div class="layui-input-inline">
                    <select name="fangjia">
                      <option value="">选择类型</option>
                      <option value="1" {if !empty(input('get.fangjia')) && input('get.fangjia')==1}selected{/if}>正常
                      </option>
                      <option value="2" {if !empty(input('get.fangjia')) && input('get.fangjia')==2}selected{/if}>已放假
                      </option>
                    </select>
                  </div>
                </div>
                <div class="layui-form-item layui-inline">
                  <label class="layui-form-label">预支开关状态</label>
                  <div class="layui-input-inline">
                    <select name="yuzhi">
                      <option value="">选择类型</option>
                      <option value="1" {if !empty(input('get.yuzhi')) && input('get.yuzhi')==1}selected{/if}>关闭
                      </option>
                      <option value="2" {if !empty(input('get.yuzhi')) && input('get.yuzhi')==2}selected{/if}>开启
                      </option>
                    </select>
                  </div>
                </div>
                <div class="layui-form-item layui-inline">
                  <label class="layui-form-label">打卡导出月份</label>
                  <div class="layui-input-inline">
                    <input type="text" id="dates" name="dates" placeholder="月份" value="{:input('get.dates')}"
                      autocomplete="off" class="layui-input" />
                  </div>
                </div>
                <div class="layui-form-item layui-inline">
                  <label class="layui-form-label">关键字</label>
                  <div class="layui-input-inline">
                    <input type="text" name="title" placeholder="搜索账号|备注" value="{:input('get.title')}"
                      autocomplete="off" class="layui-input" />
                  </div>
                </div>
                <div class="layui-form-item layui-inline">
                  <input type="hidden" name="sorts" value="{:input('get.sorts')}" class="layui-input" />
                  <input type="hidden" name="ustatus" value="{:input('get.ustatus')}" class="layui-input" />
                  <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="sreach">
                    搜索
                  </button>
                </div>
              </form>
            </fieldset>
          </div>
          <div class="layui-card-body layui-row layui-col-space10">
            <a title="回收站" onclick="open_add4('回收站(恢复删除用户)','/shop/recuser')" href="javascript:;"
              class="layui-btn layui-btn-sm layui-bg-red">
              回收站(恢复删除用户)
            </a>
            <button class="layui-btn layui-bg-cyan layui-btn-sm" onclick="open_add('添加用户','user_edit')">
              添加用户
            </button>
            {if !empty(input('get.dates'))}
            <a title="导出打卡" target="_blank" href="/shop/usersignexcel?ids={$ids|raw}&dates={:input('get.dates')}"
              class="layui-btn layui-btn-sm">
              导出本页督导{:input('get.dates')}打卡数据
            </a>
            {else}
            <a title="导出打卡" target="_blank" href="/shop/usersignexcel?ids={$ids|raw}&dates={:date('Y-m')}"
              class="layui-btn layui-btn-sm">
              导出本页督导{:date('Y-m')}打卡数据
            </a>
            {/if}
            共有数据：<strong id="count">{$list->total()}</strong> 条
          </div>
          <div class="layui-table-body layui-table-main">
            <table class="layui-table">
              <thead>
                <tr>
                  <th>
                    <div class="layui-table-cell">ID</div>
                  </th>
                  <th>
                    <div class="layui-table-cell">类型</div>
                  </th>
                  <th>
                    <div class="layui-table-cell">账号</div>
                  </th>
                  <th>
                    <div class="layui-table-cell">状态
                      <div onclick="tbsorts()" style="color: blue;font-size: 12px;display: inline-block;">切换</div>
                    </div>
                  </th>
                  <th>
                    <div class="layui-table-cell">回寄通知次数</div>
                  </th>
                  <th>
                    <div class="layui-table-cell">组别</div>
                  </th>
                  <th>
                    <div class="layui-table-cell">联系电话</div>
                  </th>
                  <th>
                    <div class="layui-table-cell">备注</div>
                  </th>
                  <th>
                    <div class="layui-table-cell">操作</div>
                  </th>
                </tr>
              </thead>
              <tbody>
                {foreach $list as $v}
                <tr>
                  <td>
                    <div class="layui-table-cell">{$v.id}</div>
                  </td>
                  <td>
                    <div class="layui-table-cell">{$v.type_text}{if $v.type == 3}{if $v.sonstype == 1 }[经理]{/if}{if
                      $v.sonstype == 2 }[助理]{/if}{/if}{if $v.type == 2}{if $v.sonstype == 1 }[督导]{/if}{if
                      $v.sonstype == 2 }[专员]{/if}{/if}</div>
                  </td>
                  <td>
                    <div class="layui-table-cell">{$v.account}(附近店铺可见{$v.km|default="0"}km)
                      {if $v.type == 2} {if $v.httext == 1}[寄待审核]{elseif $v.httext == 2}[已邮寄]{elseif $v.httext ==
                      3}[已驳回]{else}[未邮寄]{/if}{/if}
                      {if !empty($v.openid)}<button type="button" class="layui-btn layui-btn-xs">已消息授权</button>{/if}
                    </div>
                  </td>
                  <td>
                    <div style="padding:0 15px;width: 150px;">
                      <div>
                        {if $v.fangjia == 1}
                        <a title="删除" style="font-size: 16px;display: inline-block;"
                          onclick="open_status(this, '/shop/user_status1','{$v.id}',2,'该操作后督导会变成放假状态,可在用户列表解除，确定操作?')"
                          href="javascript:;" class="layui-btn-danger layui-btn layui-btn-xs">
                          标记为放假
                        </a>
                        {else}<a title="解除放假" style="font-size: 16px;display: inline-block;"
                          onclick="open_status(this, '/shop/user_status1','{$v.id}',1,'该操作后督导会取消放假状态,确定操作?')"
                          href="javascript:;" class="layui-btn layui-btn-xs">
                          解除放假
                        </a>{/if}
                        {if $v.userstatus == 1}
                        <a title="删除" style="font-size: 16px;display: inline-block;"
                          onclick="open_status(this, '/shop/user_status','{$v.id}',1,'该操作会解除督导提交的最新一次的待单申请，不会影响订单撤销等的操作状态')"
                          href="javascript:;" class="layui-btn-danger layui-btn layui-btn-xs">
                          待单
                        </a>
                        {else}繁忙{/if}
                      </div>
                      {if $v.yuzhi == 1}|预支关闭{else}|预支开启{/if}<br />
                      {if !empty($v.userstatus_address) && $v.userstatus == 1}<span
                        style="font-size: 12px;">{$v.userstatus_address}</span>{/if}
                    </div>
                  </td>
                  <td>
                    <div style="padding:0 10px;max-width: 100px;">{$v.hjtz|default="0"}次</div>
                  </td>
                  <td>
                    <div style="padding:0 10px;max-width: 150px;">{$v.groups_text|default=""}</div>
                  </td>
                  <td>
                    <div style="padding:0 10px;max-width: 100px;">{$v.mobile}</div>
                  </td>
                  <td>
                    <div style="padding:0 10px;max-width: 100px;">{$v.remark}</div>
                  </td>

                  <td class="layui-table-col-special">
                    <div class="layui-table-cell">
                      {if $v.type == 2 && $v.httext > 0}
                      <a title="合同邮寄查看" onclick="open_add2('合同邮寄查看','/shop/uploadtk?user_id={$v.id}')"
                        href="javascript:;" class="layui-btn layui-btn-sm">
                        合同邮寄查看
                      </a>
                      {/if}
                      <a title="编辑" onclick="open_add('编辑','/shop/user_edit?id={$v.id}')" href="javascript:;"
                        class="layui-btn layui-btn-sm">
                        编辑
                      </a>
                      <a title="上传文件" onclick="open_add('编辑','/shop/wenjian?userid={$v.id}')" href="javascript:;"
                        class="layui-btn layui-btn-sm">
                        文件列表
                      </a>
                      {if $v.type == 2}
                      <a title="考核" onclick="open_add('编辑','/shop/kaoke?id={$v.id}')" href="javascript:;"
                        class="layui-btn layui-btn-sm">
                        考核
                      </a>
                      {/if}
                      <a title="查看打卡日历" onclick="open_addm('查看打卡日历','/web/#/pages/kaoqin/TimeRecord2?id={$v.id}')"
                        href="javascript:;" class="layui-btn layui-btn-sm">
                        查看打卡日历
                      </a>
                      <a title="打卡记录明细" onclick="open_add4('编辑','/shop/usersign?id={$v.id}')" href="javascript:;"
                        class="layui-btn layui-btn-sm">
                        打卡记录明细
                      </a>
                      <a title="活动轨迹" onclick="open_add('编辑','/shop/riderlat?id={$v.id}')" href="javascript:;"
                        class="layui-btn layui-btn-sm">
                        活动轨迹
                      </a>
                      <a title="删除" onclick="open_dels(this,'/shop/user_del','{$v.id}')" href="javascript:;"
                        class="layui-btn-danger layui-btn layui-btn-sm">
                        删除
                      </a>
                    </div>
                  </td>
                </tr>
                {/foreach}
              </tbody>
            </table>
          </div>
          <div class="layui-card-body">
            <div class="page">{$list->render()|raw}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
  {include file="public/footer"}
  <script>
    function tbsorts() {
      layui.use(['form', 'layer'], function () {
        $ = layui.jquery;
        var form = layui.form
          , layer = layui.layer;
        var sort = $('input[name="sorts"]').val();
        if (!sort || sort == 1) {
          $('input[name="sorts"]').val(2);
        } else {
          $('input[name="sorts"]').val(1);
        }
        form.render();
      });
      var currentUrl = location.href + '&sorts=' + $('input[name="sorts"]').val();
      location.href = currentUrl;
    }
    layui.use(['form', 'layer', 'laydate'], function () {
      $ = layui.jquery;
      var laydate = layui.laydate;
      var form = layui.form
        , layer = layui.layer;
      laydate.render({
        elem: '#dates' //指定元素
        , type: 'month'
      });
    });
  </script>
</body>